package cn.han.collection;

import java.util.ArrayList;
import java.util.Collection;

//本类用于测试collection接口的常用方法
public class TestCollection {
    public static void main(String[] args) {
        //1.创建collection相关的对象
        Collection<Integer> c1 =new ArrayList();
        Collection<Integer> c2 =new ArrayList<Integer>();

        //2.向集合中添加元素
        c1.add(100);
        c1.add(200);
        c1.add(400);
        c1.add(300);
        c1.add(500);
        c2.equals(200);
        c1.contains(200);
        c1.isEmpty();
        c1.remove(400);
        c1.size();
        //c1.toArray();//将集合转为数组
        c1.forEach(o-> System.out.println(o));
    }
}
